package com.bosssoft.platform.fasttcc.log.file;

public enum LogRecordSchema
{
    CREATE_TCC_TRANSACTION((byte) 1),//
    REGISTER_lOCAL_TRANSACTION((byte) 2),//
    REGISTER_TCC_INVOKE((byte) 3),//
    REGISTER_REMOTE_RESOURCE((byte) 4), //
    UPDATE_TRANSACTION_STATE((byte) 5);
    private byte value;

    LogRecordSchema(byte value)
    {
        this.value = value;
    }

    public byte schema()
    {
        return value;
    }

    public static LogRecordSchema valueOf(byte value)
    {
        if (value == 1)
        {
            return CREATE_TCC_TRANSACTION;
        }
        else if (value == 2)
        {
            return REGISTER_lOCAL_TRANSACTION;
        }
        else if (value == 3)
        {
            return REGISTER_TCC_INVOKE;
        }
        else if (value == 4)
        {
            return REGISTER_REMOTE_RESOURCE;
        }
        else if (value == 5)
        {
            return UPDATE_TRANSACTION_STATE;
        }
        else
        {
            throw new IllegalArgumentException();
        }
    }

}
